home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 15
/
Aminet 15 - Nov 1996.iso
/
Aminet
/
comm
/
mail
/
YamNet.lha
/
rexxtra12.lha
/
rexx
/
ListEnv.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1990-03-18
|
1KB
|
52 lines
/* ListEnv.rexx */
/*
Format
ListEnv [var]
List all or a specific ENV variable.
*/
call addlib 'rexxextra.library',-20,-30,0
facility = 'ListEnv'
retcode = 0
template = 'VAR'
dtemplate = template
args. = ''
parse arg g_c
do while g_c='?'
options prompt dtemplate': ' /* this template is */
parse pull g_c /* displayed to the user */
if g_c='?' then do
g_s=sourceline(3)
if pos('/*',g_s)=0 then break; if pos('*/',g_s)>0 then break
say
g_s=sourceline(4)
do i=5 while pos('*/',g_s)=0; say g_s; g_s=sourceline(i); end
say
end
end
interpret Cparse(g_c,template,'args')
if args.ERRCODE > 1 then do; say facility'-E-BADARGS,' args.ERRTEXT; exit 5; end
var = args.VAR
width = (screencols()-30)%8
namewidth = 20
trailer = '1B'x || '[0m'
lines = sortwords(showdir('ENV:','F'))
do i = 1 to words(lines)
line = word(lines,i)
if var = '' | abbrev(upper(line),var,1) then do
v = compress(getenv(line),'0A'x)
if length(v) > width-namewidth-1 then
v = substr(v,1,width-namewidth-4) || '...'
say left(line,namewidth) v || trailer
end
end
exit retcode